package cn.edu.zjgsu.controller;

import cn.edu.zjgsu.model.User;
import cn.edu.zjgsu.service.UserService;
import cn.edu.zjgsu.template.ResultPageBean;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: wqmei
 * DateTime: 2017/11/10 12:01
 * Description:
 */
@RestController
public class UserController
{
    @Autowired
    UserService userService;

    /**
     * 查看所有用户,超级管理员可以
     * @return
     */
    @GetMapping("users")
    @RequiresPermissions({"superPermission"})
    @RequiresAuthentication
    public ResultPageBean getUsers()
    {
        ResultPageBean result = new ResultPageBean();
        List<User> users = userService.getUsers();
        result.setData(users);
        return result;

    }

}
